<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:70:"/www/wwwroot/xunda-college/application/atxunda/view/sub/ques_edit.html";i:1702282166;s:69:"/www/wwwroot/xunda-college/application/atxunda/view/index/header.html";i:1700617178;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="__PUBLIC__css/pintuer.css?v=1.0">
<link rel="stylesheet" href="__PUBLIC__admin/admin.css">
<link rel="stylesheet" href="__PUBLIC__layui/css/layui.css">
<script src="__PUBLIC__js/jquery.js"></script>
<script src="__PUBLIC__js/pintuer.js"></script>
<script src="__PUBLIC__js/cookie.js"></script>
<script src="__PUBLIC__layui/layui.js"></script>
</head>
<style type="text/css">
	.refresh{width: 20px;height: 20px;float: right;margin:10px 20px;display: block;}
</style>
</head>
<?php if(request()->controller() != 'Index'): ?><img src="__PUBLIC__images/refresh.png" class="refresh" title="刷新"><?php endif; ?>
<script type="text/javascript">
	$('.refresh').click(function(){layer.msg('刷新中……');window.location.reload();})
</script>
<script type="text/javascript">
	function openwinx(url,name,w,h) {
		if(!w) w=screen.width-4;
		if(!h) h=screen.height-95;
		window.open(url,name,"width=" + w + ",height=" + h + ",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no");
	}
</script>
<link rel="stylesheet" href="__PUBLIC__editor/css/editormd.css"/>
<script src="__PUBLIC__editor/editormd.js"></script>
<style type="text/css">
	.answer_radio{margin-left: 20px;display: block;float: left;line-height: 41px;}
</style>
<div class="panel admin-panel margin-top" id="add">
	<div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 增加内容/<?php echo $choices; ?></strong></div>
	<div class="body-content">
		<form method="post" class="form-x" action="" onkeydown="if(event.keyCode==13){return false;}" onsubmit="return checkRadio()">
			<div class="form-group">
				<div class="label">
					<label>选择：</label>
				</div>
				<div class="field">
					<select name="nav_id" class="input w50"  id="nav" data-validate="required:请选择专业">
						<option value="">请选择专业</option>
						<?php foreach($nav_data as $nav): ?>
						<option value="<?php echo $nav['nav_id']; ?>" <?php if($data['nav_id'] == $nav['nav_id']): ?>selected<?php endif; ?>><?php echo $nav['nav_name']; ?></option>
						<?php endforeach; ?>
					</select>  
					<select name="type_id" class="input w50" id="type" data-validate="required:请选择阶段">
						<option value="">请选择阶段</option>
						<?php foreach($type_data as $type): ?>
						<option value="<?php echo $type['type_id']; ?>" <?php if($data['type_id'] == $type['type_id']): ?>selected<?php endif; ?>><?php echo $type['type_name']; ?></option>
						<?php endforeach; ?>
					</select>
					<select name="s_id" class="input w50" id="s" data-validate="required:请选择章节">
						<option value="">请选择章节</option>
						<?php foreach($s_data as $s): ?>
						<option value="<?php echo $s['s_id']; ?>" <?php if($data['s_id'] == $s['s_id']): ?>selected<?php endif; ?>><?php echo $s['s_name']; ?></option>
						<?php endforeach; ?>
					</select>
					<select name="course_id" class="input w50" id="course" data-validate="required:请选择课程">
						<option value="">请选择课程</option>
						<?php foreach($course_data as $course): ?>
						<option value="<?php echo $course['course_id']; ?>" <?php if($data['course_id'] == $course['course_id']): ?>selected<?php endif; ?>><?php echo $course['course_name']; ?></option>
						<?php endforeach; ?>
					</select>
					<div class="tips"></div>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label>定位视频节点：</label>
				</div>
				<div class="field">
					<input name="seek" type='number'  class="input w50" value="<?php echo !empty($data['seek'])?$data['seek']: 0; ?>" data-validate="required:请输入标题" />
					<div class="tips"></div>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label>题干/标题：</label>
				</div>
				<div class="field">
					<div id="test-editormd">
						<textarea name="stem" style="display:none;" id="ts"><?php echo $data['stem']; ?></textarea>
					</div>
					<div class="tips"></div>
				</div>
			</div>
			<?php if($data): foreach($data['choices'] as $key=>$v): ?>
			<div class="form-group">
				<div class="label">
					<label class="labelCommon label<?php echo $v['zimu']; ?>">选项<?php echo $v['zimu']; ?>：</label>
				</div>
				<div class="field">
					<input type="text" class="input w50" name="choices[]" value="<?php echo $v['content']; ?>" <?php if($key <= 1): ?>data-validate="required:请输入内容"<?php endif; ?> />
					<div class="tips"></div>
					<label class="answer_radio"><input type="radio"  name="answer[]" value="<?php echo $key; ?>" <?php if(in_array(($key), is_array($data['answer'])?$data['answer']:explode(',',$data['answer']))): ?> checked="" <?php endif; ?>>正确答案</label>
				</div>
			</div>
			<?php endforeach; else: ?>
			<div class="form-group">
				<div class="label">
					<label class="labelCommon labelA">选项A：</label>
				</div>
				<div class="field">
					<input type="text" class="input w50" name="choices[]"  data-validate="required:请输入内容" />
					<div class="tips"></div>
					<label class="answer_radio"><input type="radio" name="answer[]" value="0">正确答案</label>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label class="labelCommon labelB">选项B：</label>
				</div>
				<div class="field">
					<input type="text" class="input w50" name="choices[]" />
					<div class="tips"></div>
					<label class="answer_radio"><input type="radio" name="answer[]" value="1">正确答案</label>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label class="labelCommon labelC">选项C：</label>
				</div>
				<div class="field">
					<input type="text" class="input w50" name="choices[]" />
					<div class="tips"></div>
					<label class="answer_radio"><input type="radio" name="answer[]" value="2">正确答案</label>
				</div>
			</div>
			<div class="form-group choiceD">
				<div class="label">
					<label class="labelCommon labelD">选项D：</label>
				</div>
				<div class="field">
					<input type="text" class="input w50" name="choices[]" />
					<div class="tips"></div>
					<label class="answer_radio"><input type="radio" name="answer[]" value="3">正确答案</label>
				</div>
			</div>
			<?php endif; ?>
			<div class="form-group">
				<div class="label">
					<label>解析：</label>
				</div>
				<div class="field">
					<div id="test-editormd1">
						<textarea name="analysis" style="display:none;" id="ts"><?php echo $data['analysis']; ?></textarea>
					</div>
					<div class="tips"></div>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label>掌握点：</label>
				</div>
				<div class="field">
					<input type="number" class="input w50" name="points" value="<?php echo !empty($data['points'])?$data['points']: 1; ?>"  data-validate="required:,number:掌握点必须为数字" />
					<div class="tips"></div>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label></label>
				</div>
				<div class="field">
					<button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
				</div>
			</div>
		</form>
	</div>
</div>
<script type="text/javascript" src="__PUBLIC__admin/select.js?v=1.0.0"></script>
<script type="text/javascript">
	var testEditor;
	testEditor = editormd("test-editormd", {
		height  : 640,
		syncScrolling : "single",
		path    : "/public/editor/lib/",
		saveHTMLToTextarea : true,//注意3：这个配置，方便post提交表单
		/**上传图片相关配置如下*/
		imageUpload : true,
		imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
		imageUploadURL : "/editor/uploads",//注意你后端的上传图片服务地址
	});
	testEditor = editormd("test-editormd1", {
		height  : 640,
		syncScrolling : "single",
		path    : "/public/editor/lib/",
		saveHTMLToTextarea : true,//注意3：这个配置，方便post提交表单
		/**上传图片相关配置如下*/
		imageUpload : true,
		imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
		imageUploadURL : "/editor/uploads",//注意你后端的上传图片服务地址
	});
</script>